package com.per.yyyFrame.controller;

import com.per.yyyFrame.common.CheckParam;
import com.per.yyyFrame.common.ServerResponse;
import com.per.yyyFrame.enums.RespCode;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 *
 * @author: yyy
 * Date: 2022/2/7
 * Time: 15:50
 * Description:
 */
@RestController
@RequestMapping("yyy/test/")
public class CheckController {

  @GetMapping("getUserList")
  public ServerResponse getUserList(@RequestParam Map map){
    CheckParam.checkInit(map)
            .param("userId").checkCondition("用户id必传")
            .param("userPhone").checkCondition("用户手机号必传")
            .verify();
    if(Integer.valueOf(map.get("userId").toString())>2){
      return new ServerResponse(RespCode.ERROR.getCode(),"该用户不存在");
    }
    return new ServerResponse(RespCode.SUCCESS.getCode(),"这是返回的数据");
  }
}
